package com.example.medicine.Mapper.yian;


import com.example.medicine.Bean.yian.yian_jiancha;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface yian_jianchaMapper {
    @Select("select * from [yian_jiancha]")
    public List<yian_jiancha> getAll();
    @Select("select * from [yian_jiancha] where yianid=#{yianid}")
    public List<yian_jiancha> getByYianId(long yianid);

    @Insert("insert into [yian_jiancha](yianid,jianchaxiangmu,shijian,jieguo,tupian) values(#{yianid},#{jianchaxiangmu},#{shijian},#{jieguo},#{tupian})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    public void insertOne(yian_jiancha yian_jiancha);

    @Insert("<script>" +
            "INSERT INTO [yian_jiancha] (yianid, jianchaxiangmu, shijian, jieguo, tupian) VALUES " +
            "<foreach collection='list' item='item' separator=','>" +
            "(#{item.yianid}, #{item.jianchaxiangmu}, CONVERT(datetime2, #{item.shijian}), #{item.jieguo}, #{item.tupian})" +
            "</foreach>" +
            "</script>")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    void insertBatch(List<yian_jiancha> list);


    @Delete("delete from [yian_jiancha] where yianid=#{yianid}")
    public void deleteByYianId(long yianid);

}
